package com.xian.im.common.model.session;

import com.xian.im.common.model.vo.UserDetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;

/**
 * webSocket路径参数
 * /{appKey}/{sign}/{account}/{channel}/{version}/{deviceId}
 */
@Data
@Builder
public class SessionUser implements Serializable {

    private String account;
    private String channel;
    private String appKey;
    private String sign;
    private String version;
    private String deviceId;
    private String realIp;
    private String param;
    private String groupId;

    /**
     * 头像
     */
    @ApiModelProperty("头像")
    private String avatarUrl;
    /**
     * 昵称
     */
    @ApiModelProperty("昵称")
    private String nickname;
    /**
     * 个性签名
     */
    @ApiModelProperty("个性签名")
    private String signature;

    /**
     * 渠道ID
     */
    @ApiModelProperty("渠道ID")
    private Long orgId;


    public UserDetail build() {
        UserDetail user = new UserDetail();
        user.setAccount(getAccount());
        user.setAvatarUrl(getAvatarUrl());
        user.setNickname(getNickname());
        user.setOrgId(getOrgId());
        user.setSignature(getSignature());
        return user;
    }
}
